"""
用户 Token PO
"""

from models import POBase
from my_typing import *
from utils.data_utils.special import ObjectIdStr
from utils.validator_utils.pydantic_validator.field import (
    CharField,
    IntegerField,
    NormalField,
)


class UserTokenPO(POBase):
    """ 用户 | Token | PO """

    expire_time: datetime = NormalField(..., title="过期时间")
    issue_time: datetime = NormalField(..., title="签发时间")
    key: str = CharField(..., title="Token")
    token_max_age: int = IntegerField(..., title="有效天数", min_value=1, max_value=30)
    user_id: ObjectIdStr = CharField(..., title="用户 ID")
